package com.github.pojo;

import com.github.util.Status;
import lombok.Data;

@Data
public class Result<T> {
    private int status;
    private String msg;
    private T data;

    public Result() {
    }

    public Result(int status, String msg, T data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public static Result<?> success(Object data) {
        return new Result<>(Status.SUCCESS.getStatus(), "成功", data);
    }

    public static Result<?> error(String msg) {
        return new Result<>(Status.FAILED.getStatus(), msg, null);
    }
}
